Guide to BasiCE  ---  By Thomas Graupner (thomasg@mts.net)

This is a mostly-complete guide to BasiCE (a basic interpreter for Handheld Computers running Windows CE 1.0).
BasiCE was written by Dean Geinger, and can be downloaded at: http://pda.tucows.com/wince/files/basice.zip

I started to make this guide on Jul. 22, 2000. I stopped working on it after my Compaq C120++'s keyboard stopped
working (Oct. 12, 2000). Right now, the guide contains a list of every command/function, and says what most of
them do.

If you like this guide, and want to send me some money for it (any amount is fine), please E-Mail me for details.
-----------------------------------------------------------------------------------------------------------------

GO (cmd screen only):
"go" = runs current program code.
"go x"
/\
1) If procedure x exists, then it goes to step 3.
2) Loads all the procedures in file "\basice\lib\x.utl".
3) Runs the code in procedure x.
"go x1(x2)"
/\
1) If procedure x1 exists, then it goes to step 3.
2) Loads all procedures in file "\basice\lib\x1.utl".
3) Puts the value(s) of the expression(s) in expression group x2, into the variable(s) in procedure x1's variable list.
4) Runs the code in procedure x1.
See Also: "PROCEDURE"

LIST (cmd screen only):
"list" = lists all the lines in the current program code.
"list x" = lists line number x/10-999 in current program code.  x is an integer.

RUN (cmd screen only):
"run" = this command does exactly what the "GO" command does.

DEL:
{incomplete}

SAVE (cmd screen only):
"save x" = saves the current program code, to file x.  x is a string.

LOAD (cmd screen only):
"load x" = clears the current program code, and deletes any existing variables.  Then is stores a canned version of the code in program file x, to the current program code.  x is a string.

MERGE (cmd screen only):
"merge x" = adds a canned version of the code in program file x, onto the current program code.  x is a string.

NEW (cmd screen only):
"new" = clears the current program code, and deletes any existing variables.

VARS (cmd screen only):
"vars" = displays a list of all the existing variables.

CONTINUE (cmd screen only):
{incomplete}

CANCEL (cmd screen only):
{incomplete}

SET:
{incomplete}

IF (run mode only):
----------
if x1 then
x2
endif
----------
/\ If number expression x1's value is not equal to zero, the code x2 executes.
See Also: "ELSE"

THEN (run mode only):
See "IF".

ELSE (run mode only):
----------
if x1 then
x2
else
x3
endif
----------
/\ If number expression x1's value is not equal to zero, then code x2 executes, otherwise code x3 executes.

FOR (run mode only):
--------------------
loop for x1=x2 to x3
x4
endloop
--------------------
/\
1) Stores integer expression x2's value, to integer variable x1.
2) Executes code x4.
3) Adds one to integer variable x1's value.
4) If integer variable x1's value is not greater than what integer expression x3's value was when the loop started, then it goes back to step 2.
See Also: "STEP"

KILL (run mode only):
"kill x" = deletes file x.  x is a string expression.

CALL (run mode only):
"call x"
/\
1) If procedure x exists, then it goes to step 3.
2) Loads all the procedures in file "\basice\lib\x.utl".
3) Runs the code in procedure x.
"call x1(x2)"
/\
1) If procedure x1 exists, then it goes to step 3.
2) Loads all procedures in file "\basice\lib\x1.utl".
3) Puts the value(s) of the expression(s) in expression group x2, into the variable(s) in procedure x1's variable list.
4) Runs the code in procedure x1.
See Also: "PROCEDURE"

PRINT (both cmd screen and run mode):
"print x" = displays the value(s) of the expression(s) in expression group x, to the current line on the screen.  Then it moves the current line down one line.  If the current line becomes off the screen, then everything on the screen gets moved up one line, and the current line becomes the bottom line.
"print #x1,x2" = stores the value(s) of the expression(s) that is/are in expression group x2, to the current line of the file with file channel number x1 assigned to it.  Then it adds a blank line to the file, and makes that line the current line.  x1 is an integer expression.
See Also: "CREATE"

INPUT (run mode only):
"input x" = waits for the user to enter a data group.  Then it stores the data that is in the data group, to the variable(s) in variable list x.
"input #x1,x2" = stores the data that is in the data group which is in the current line of the file with file channel number x1 assigned to it, to the variable(s) in variable list x2.  Then it moves the current line down one line.  x1 is an integer expression.
See Also: "OPEN"

UNDIM (run mode only):
"undim x" = if variable x is an array, then it turns it into a standard variable, deleting all it's data.

END (run mode only):
"end" = stops the program, and goes to the command screen.

{reformatted up to here}

OPEN (run mode only):
"open x1,x2" = opens file x1 for reading only, and assigns file channel number x2 to it.  There are 10 valid file channel numbers, they are numbers 0 through 9.  x1 is a string expression.  x2 is an integer expression.
See Also: "INPUT", "CLOSE", "LINPUT"

CLOSE (run mode only):
"close x" = closes file with file channel number x assigned to it.  x is an integer expression.
See Also: "OPEN", "CREATE"

CREATE (run mode only):
"create x1,x2" = if a file x1 exists, it erases all it's data, otherwise it creates a blank file x1.  Then it opens file x1 for writing only, and assigns file channel number x2 to it.  There are 10 valid file channel numbers, they are numbers 0 through 9.  x1 is a string expression.  x2 is an integer expression.
See Also: "PRINT", "CLOSE"

LINPUT (run mode only):
"linput x" = displays a cursor and waits for the user to enter text.  Then it stores the text to string variable x.
"linput #x1,x2" = stores the text in the current line of the file with file channel number x1 assigned to it, to string variable x2.  Then it moves the current line down one line.  When a file is first opened, the current line is the top line.  x1 is an integer expression.
See Also: "OPEN"
{uc}

COMMENT (run mode only):
"comment x" = this command does nothing.  x is a string.

DIM (run mode only):
"dim x1[x2]" = deletes variable x1's data.  Turns variable x1 into a 1D array with x2 number of elements.  Each element can be accessed by the expression "x1[x3]" where x3 is the desired element number.  Both x2 and x3 are integer expressions.
See Also: "UNDIM"

TO:
See "FOR".
{incomplete}

STEP:
{incomplete}
----------------------------
loop for x1=x2 to x3 step x4
x5
endloop
----------------------------
/\
1) Changes integer variable x1 to integer expression x2's value.
2) Executes code x5.
3) Adds what integer expression x4's value was when the loop started, to integer variable x1.
4) If integer variable x1 is not above what integer expression x3's value was when the loop started, then it goes back to step 2.

RETURN (run mode only):
"return(x)" = ends the current procedure.  If the procedure is being used like an integer, real or string variable, it returns expression x's value as the procedure's data.
When a procedure is being used like an integer, real or string variable, an INTEGER (%), REAL (#) or STRING ($) identifier does not need to be used.

ON:
(incomplete)

ENDIF (run mode only):
See "IF".

PROCEDURE (run mode only):
------------
procedure x1
x2
endproc
------------
/\ If a program with this code is loaded, it adds code x2 to procedure variable x1.  If the command "go x1", "run x1" or "call x1" is executed, code x2 executes.
----------------
procedure x1(x2)
x3
endproc
----------------
/\ If a program with this code is loaded, it adds variable list x2 and code x3 to procedure variable x1.  If the command "go x1(x4)", "run x1(x4)" or "call x1(x4)" is executed, the value(s) of the expression(s) in expression group x4 is/are out into the variable(s) in variable list x2, then code x3 executes.
Procedures are meant to be seprate sub-routines, and can not be part of a code segment.
See Also: "GO", "RUN", "CALL", "RETURN"

ENDPROC (run mode only):
See "PROCEDURE".

BREAK (run mode only):
"break" = ends current loop.
See Also: "LOOP"

LOOP (run mode only):
-------
loop
x
endloop
-------
/\ repeats code x forever, unless code x stops it.
See Also: "FOR", "BREAK", "WHILE"

ENDLOOP (run mode only):
See: "LOOP".

get:
{incomplete}

do:
{incomplete}

WAIT (run mode only):
"wait x" = pauses the program for x number of seconds.  x is a number expression.

connect:
{incomplete}

EXIT (run mode only):
"exit" = ends current BasiCE session.

FROM:
{incomplete}

LOG:
{incomplete}

WHILE (run mode only):
"while x" =  if expression x's value is equal to zero, then it instructs the current loop to end after the code within the loop has finished running.
See Also: "LOOP"

GOTO:
"goto x" = goes to line number x.  x is an integer expression.


SQR:
"sqr(x)" = returns the square-root of number expression x, in real format.

LN:


EXP:


TAN:


ATN:


SIN:


COS:


ABS:
"abs(x)" = returns the absolute value of number expression x, in number format.

INT%:
"int(x)" = returns number expression x's value, in integer format.

PEEKB%:
"peekb%(x)" = returns the character number of byte x in memory, in integer format.  x is an integer expression.

PEEKW%:


RIGHT$:
"right$(x1,x2)" = returns string expression x1's value, without the first x2 characters, in string format.  x2 is a number expression.

LEFT$:
"left$(x1,x2)" = returns the first x2 characters of string expression x1's value, in string format.  x2 is a number expression.

MID$:
"mid$(x1,x2,x3)" = returns characters x2 through x2+x3-1 of string expression x1's value, in string format.  x2 and x3 are number expressions.

LEN%:
"len%(x)" = returns number of characters in string expression x's value, in integer format.

CHR$:
"chr$(x)" = returns character number x, in string format.  x is a number expression.

ASC%:
"asc%(x1,x2)" = returns the character number of character x2 in string expression x1's value, in integer format.  x2 is an integer expression.
{uc}

ERR%:


ERL%:


MOD%:
"mod(x1,x2)" = returns the remainder of the integer portion of x1, divided by the integer portion of x2, in integer format.

POWER:
"power(x1,x2)" = returns x1^x2, in number format.  x1 is a number expression.  x2 is a number expression.

POS%:
"pos%(x1,x2)" = returns the left-most of the location(s) in string expression x2's value, where string expression x1's value exists, in integer format.  If string expression x1's value does not exist in string expression x2's value, it returns 0, in integer format.
{uc}

SEARCH$:


ADR%
"adr%(x)" = returns the location in memory, where expression x is stored, in integer format.

FMT$:


DTIME$:
"dtime$(x)" = returns the computer's date and time in "YYYY-MM-DD HH:MM:SS.SS" format, in string format.  The hour is given in 24 hour format.  x is a number expression.

KEY$:
"key$" = returns the character value of the current set of keys that are being pressed, in string format.

CMDLINE$:


COMCH%:


QIOW%:


SCRLINE$:
"scrline$(x1)" = returns "x1 ** NO Lx2", in string format.  If line number x1/10-999 does not exist, it returns "x1 ** NO LINE FOUND.", in string format.  x1 is an integer expression.  x2 is a string expression which contains the text in line number x1/10-999.

SHIFT%:


TRNLNM$:



+:
"x1+x2" = if both expressions x1 and x2 are number expressions, then it returns x1+x2, in number format.  Otherwise, it returns the string value of expression x1 with the string value of expression x2 added on it, in string format.
{uc}

-:
"x1-x2" = returns x1-x2, in number format.  Both x1 and x2 are number expressions.

*:
"x1*x2" = returns x1*x2, in number format.  Both x1 and x2 are number expressions.

/:
"x1/x2" = returns x1/x2, in number format.  Both x1 and x2 are number expressions.

OR:


AND:


NOT:
"not x" = if number expression x's value is not equal to zero, then it returns 0 in number format, otherwise it returns -1 in number format.

>:
"x1>x2" = If both expression x1 and expression x2 are number expressions then, if expression x1's value is greater than expression x2's value, it returns 1, otherwise it returns 0.  If both expression x1 and expression x2 are string expressions then, if expression x1's binary value is greater than expression x2's binary value, it returns 1 otherwise it returns 0.
Anything this function returns, is in integer format.

<:
"x1<x2" = If both expression x1 and expression x2 are number expressions then, if expression x1's value is lesser than expression x2's value, it returns 1, otherwise it returns 0.  If both expression x1 and expression x2 are string expressions then, if expression x1's binary value is lesser than expression x2's binary value, it returns 1 otherwise it returns 0.
Anything this function returns, is in integer format.

>=:
"x1>=x2" = If both expression x1 and expression x2 are number expressions then, if expression x1's value is greater than or equal to expression x2's value, it returns 1, otherwise it returns 0.  If both expression x1 and expression x2 are string expressions then, if expression x1's binary value is greater than or equal to expression x2's binary value, it returns 1 otherwise it returns 0.
Anything this function returns, is in integer format.

<=:
"x1<=x2" = If both expression x1 and expression x2 are number expressions then, if expression x1's value is lesser than or equal to expression x2's value, it returns 1, otherwise it returns 0.  If both expression x1 and expression x2 are string expressions then, if expression x1's binary value is lesser than or equal to expression x2's binary value, it returns 1 otherwise it returns 0.
Anything this function returns, is in integer format.

=:
"x1=x2" = If expression x1's value is equal to expression x2's value, it returns 1 in integer format, otherwise it returns 0 in integer format.  Expressions x1 and x2 must both be number expressions or must both be string expressions.

<>:
"x1=x2" = If expression x1's value is not equal to expression x2's value, it returns 1 in integer format, otherwise it returns 0 in integer format.  Expressions x1 and x2 must both be number expressions or must both be string expressions.

@:


(:


):


[:
See "DIM" in the command index.

]:
See "DIM" in the command index.

,:


;:


XOR:


#:
See: "PRINT", "INPUT", "LINPUT".

